﻿using System;
using System.Collections;
using System.Text;

namespace Demo0
{
    class Program
    {

        public static IEnumerable TestCode1()
        {

            int x = 3;

            yield return "a";
            x++;
            yield return "b";
            x++;
            yield return "c";
            x++;
            yield return "d";
            x++;

            yield break;

        }


        static void Main(string[] args)
        {
            Console.WriteLine("TestCod1");


            IEnumerator FSM = TestCode1().GetEnumerator();


            while (FSM.MoveNext() == true)
            {

                Console.WriteLine("input any key");

                Console.ReadKey();
                Console.WriteLine("");
                Console.WriteLine("count = {0}", FSM.Current);
            }

            Console.WriteLine("TestCod1");

            foreach (int count in TestCode1())
            {
                Console.WriteLine("count = {0}", count);
            }

        }
    }
}
